package com.kzj.config;

import com.kzj.global.properties.RedissonProperties;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {
    @Autowired
    RedissonProperties redissonProperties;
    @Bean
    public RedissonClient redissonClient()
    {
        String address="redis://"+redissonProperties.getHost()+":"+redissonProperties.getPort();
        Config config=new Config();
        config.useSingleServer().setAddress(address).setPassword(redissonProperties.getPassword());
        return Redisson.create(config);
    }
}
